From 8a4bbcadab1800dd542970ff3f18b1062e8e5716 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 7 Sep 2009 08:43:14 +0100 Subject: [PATCH] amd iommu: Remove a useless flag and fix I/O page fault for hvm passthru devices. Signed-off-by: Wei Wang --- xen/drivers/passthrough/amd/iommu_map.c | 10 ---------- xen/drivers/passthrough/iommu.c | 3 ++- xen/include/xen/hvm/iommu.h | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index 9754f4b1ed..79f2e73cc6 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -459,9 +459,6 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn) spin_lock(&hd->mapping_lock); - if ( is_hvm_domain(d) && !hd->p2m_synchronized ) - goto out; - iommu_l2e = iommu_l2e_from_pfn(hd->root_table, hd->paging_mode, gfn); if ( iommu_l2e == 0 ) { @@ -472,7 +469,6 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn) } set_iommu_l1e_present(iommu_l2e, gfn, (u64)mfn << PAGE_SHIFT, iw, ir); -out: spin_unlock(&hd->mapping_lock); return 0; } @@ -488,12 +484,6 @@ int amd_iommu_unmap_page(struct domain *d, unsigned long gfn) spin_lock(&hd->mapping_lock); - if ( is_hvm_domain(d) && !hd->p2m_synchronized ) - { - spin_unlock(&hd->mapping_lock); - return 0; - } - iommu_l2e = iommu_l2e_from_pfn(hd->root_table, hd->paging_mode, gfn); if ( iommu_l2e == 0 ) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 6933e658fe..c6906871d7 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -158,7 +158,8 @@ static int iommu_populate_page_table(struct domain *d) page_list_for_each ( page, &d->page_list ) { - if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) + if ( is_hvm_domain(d) || + (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { rc = hd->platform_ops->map_page( d, mfn_to_gmfn(d, page_to_mfn(page)), page_to_mfn(page)); diff --git a/xen/include/xen/hvm/iommu.h b/xen/include/xen/hvm/iommu.h index 8ed4530044..b72656ee57 100644 --- a/xen/include/xen/hvm/iommu.h +++ b/xen/include/xen/hvm/iommu.h @@ -41,7 +41,6 @@ struct hvm_iommu { int domain_id; int paging_mode; struct page_info *root_table; - bool_t p2m_synchronized; /* iommu_ops */ struct iommu_ops *platform_ops; -- 2.30.2